package com.zx.centers.dataservice.mybatis.mapper.centers;

import com.zx.centers.dataservice.mybatis.domain.centers.SysDictData;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface SysDictDataMapper {
    @Delete({
        "delete from sys_dict_data",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into sys_dict_data (id, dict_pra_code, ",
        "dict_chi_code, dict_chi_value, ",
        "create_time, update_time, ",
        "remark)",
        "values (#{id,jdbcType=BIGINT}, #{dictPraCode,jdbcType=VARCHAR}, ",
        "#{dictChiCode,jdbcType=VARCHAR}, #{dictChiValue,jdbcType=VARCHAR}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
        "#{remark,jdbcType=VARCHAR})"
    })
    int insert(SysDictData record);

    @InsertProvider(type=SysDictDataSqlProvider.class, method="insertSelective")
    int insertSelective(SysDictData record);

    @Select({
        "select",
        "id, dict_pra_code, dict_chi_code, dict_chi_value, create_time, update_time, ",
        "remark",
        "from sys_dict_data",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="dict_pra_code", property="dictPraCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="dict_chi_code", property="dictChiCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="dict_chi_value", property="dictChiValue", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR)
    })
    SysDictData selectByPrimaryKey(Long id);

    @UpdateProvider(type=SysDictDataSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(SysDictData record);

    @Update({
        "update sys_dict_data",
        "set dict_pra_code = #{dictPraCode,jdbcType=VARCHAR},",
          "dict_chi_code = #{dictChiCode,jdbcType=VARCHAR},",
          "dict_chi_value = #{dictChiValue,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "remark = #{remark,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(SysDictData record);
}